﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace Krist_em_up.Plateforms
{
    /// <summary>
    /// Controls the collision detection and response behavior of a tile.
    /// </summary>
    public enum TileCollision
    {
        /// <summary>
        /// An impassable tile is one which does not allow the player to move through
        /// it at all. It is completely solid.
        /// </summary>
        Impassable = 1,

        /// <summary>
        /// A platform tile is one which behaves like a passable tile except when the
        /// player is above it. A player can jump up through a platform as well as move
        /// past it to the left and right, but can not fall down through the top of it.
        /// </summary>
        Passable = 2,
        EndOfLevel = 3,
    }

    /// <summary>
    /// Stores the appearance and collision behavior of a tile.
    /// </summary>
    [Serializable]
    public struct Plateform
    {
        [NonSerialized]
        public Texture2D Texture;
        public TileCollision Collision;

        public const int Width = 64;
        public const int Height = 48;
        public static readonly Vector2 Size = new Vector2(Width, Height);

        /// <summary>
        /// Constructs a new Plateform.
        /// </summary>
        public Plateform(Texture2D texture, TileCollision collision)
        {
            Texture = texture;
            Collision = collision;
        }
        public static Rectangle GetBounds(int x, int y)
        {
            return new Rectangle(x * Width, y * Height, Width, Height);
        }
    }
}
